/* gs_core.h -- Arquivo core do gearserial
 *
 * Copyright (C) 2008, Diogo F. S. Ramos <diogo.ramos@usp.br>
 * GEAR - Grupo de Estudos Avançados em Robótica
 * <http://www.sel.eesc.usp.br/gear>
 * 
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 * 
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 *
 */

#ifndef GS_CORE_H_
#define GS_CORE_H_

#include <termios.h>

typedef struct gs_core_t gs_core_t;

struct gs_core_t
{
    char * path;
    int fd;
    struct termios options;
    int speed;

    int command_size;
    unsigned char * command;
    int command_repeat;

    unsigned char * conf;
    unsigned char * motor_1;
    unsigned char * motor_2;
    unsigned char * motor_3;

    unsigned int mascara1;
    unsigned int mascara2;

    struct timespec delay;
    struct timespec sobrando;
};

gs_core_t * gs_core_new( const char * serial_path );
void gs_core_set_robot_forward( gs_core_t * self, const unsigned char speed );
void gs_core_set_robot_backward( gs_core_t * self, const unsigned char speed );
void gs_core_set_robot_turn_left( gs_core_t * self, const unsigned char speed );
void gs_core_set_robot_turn_right( gs_core_t * self, const unsigned char speed );
void gs_core_set_robot_stop( gs_core_t * self );
void gs_core_destroy( gs_core_t * self );
void gs_core_robot_kick( gs_core_t * self );
void gs_core_robot_dribble_enable( gs_core_t * self, int enable );

#endif	/* GS_CORE_H_ */
